package com.example.puy_du_fou;

import com.example.puy_du_fou.HomeActivity.MyDrawerItemClickListener;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.support.v4.widget.DrawerLayout;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ScheduleActivity extends Activity {

	private String[] drawerItemsList;
	private ListView myDrawer;
	private DrawerLayout drawerLayout;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_planning);
		drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
		drawerItemsList = getResources().getStringArray(R.array.items);
		myDrawer = (ListView) findViewById(R.id.left_drawer);
		myDrawer.setAdapter(new ArrayAdapter<String>(this,R.layout.item, drawerItemsList));
	
		myDrawer.setOnItemClickListener(new MyDrawerItemClickListener());
	}
	
	public class MyDrawerItemClickListener implements ListView.OnItemClickListener 
	{
		@Override
	public void onItemClick(AdapterView<?> adapter, View v, int pos, long id)
	{
				switch (pos)		
				{
					case 0:Intent intentHome = new Intent(getBaseContext(), HomeActivity.class); startActivity(intentHome);break;
					case 1:break;
					case 2:Intent intentShows = new Intent(getBaseContext(), ShowsActivity.class); startActivity(intentShows);break;
					case 3:Intent intentRestaurants = new Intent(getBaseContext(), RestaurantsActivity.class); startActivity(intentRestaurants);break;
					case 4:Intent intentShops = new Intent(getBaseContext(), ShopsActivity.class); startActivity(intentShops);break;
					case 5:Intent intentMap = new Intent(getBaseContext(), MapActivity.class); startActivity(intentMap);break;
					case 6:Intent intentAbout = new Intent(getBaseContext(), AboutActivity.class); startActivity(intentAbout);break;
					
				}
			
			drawerLayout.closeDrawer(myDrawer);
	}
}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	public boolean onOptionsItemSelected(MenuItem item) 
	{
	    // Handle item selection
	    switch (item.getItemId()) {
	        case R.id.quit:
 
	            return true;
	        default:
	            return super.onOptionsItemSelected(item);
	    }
	}
}
